#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

int main()
{
    int fd = open("bite", O_RDWR | O_CREAT | O_TRUNC, 0666);
    char* str = "I like linux!\n";
    write(fd, str, strlen(str));
    lseek(fd, -2, SEEK_END);

    char* str2 = " and C++!\n";
    write(fd, str2, strlen(str2));

    lseek(fd, 0, SEEK_SET);
    char buffer[1024];
    ssize_t ret = read(fd, buffer, sizeof(buffer));
    
    printf("%s", buffer);

    close(fd);
}